<html class="standard">

<head>
    <meta charset="utf-8">
    <title>个人中心</title>
    <link href="../css/im_index/ly/c.css" type="text/css" rel="stylesheet">
    <link href="../css/im_index/ly/main.css" type="text/css" rel="stylesheet">
    <link href="../css/framework/layui.css" type="text/css" rel="stylesheet">
    <link href="../css/im_index/person.css" type="text/css" rel="stylesheet">
    <!-- <link href="../css/framework/bootstrap-theme.css" type="text/css" rel="stylesheet"> -->

    <script src="../js/framework/layui.js"></script>
    <script src="../js/framework/jquery-3.2.1.min.js"></script>
    <script src="../js/framework/bootstrap.min.js"></script>
</head>

<body>

    <div id="wrap">
        <div id="header">
            <div class="top">
                <ul class="layui-nav">
                    <div id="top" class="top-in">
                        <li class="layui-nav-item home">
                            <a href="../html/home.html" class="active">首页</a>
                        </li>
                        <li class="layui-nav-item message">
                            <a href="../html/chat.html">消息 </a>
                        </li>
                        <li class="layui-nav-item person; width:auto;">
                            <a href="../html/person.html" style="color:#22d7c6">
                                <span>
                                    {{nickname}}
                                </span>
                                &nbsp;&nbsp;<img :src="avatarUrl" class="layui-nav-img"></a>
                        </li>
                        <li class="layui-nav-item">
                                <a href="" class="active" onclick="logout()">退出</a>
                        </li>
                    </div>
                </ul>

            </div>
        </div>

        <div id="service-list">
            <div id="info">
                <span style="height:2px">修改个人信息</span>
                <hr class="layui-bg-green">
                <br>
                <br>
                <div class="layui-form" >
                    <div class="layui-form-item">
                        <label class="layui-form-label">收货地址</label>
                        <div class="layui-input-block">
                            <input type="text" name="title" required lay-verify="required" placeholder="请输入昵称"
                                autocomplete="off" class="layui-input" v-model="address">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn" lay-submit lay-filter="formDemo"
                                @click="upUserinfo()">立即提交</button>
                        </div>
                    </div>
                    
                    <label>{{tip}}</label>

                </div>
            </div>
        </div>

    </div>

    </div>



    <script src="../js/framework/vue.js"></script>
    <script src="../js/framework/layui.js"></script>
    <script src="../js/framework/jquery-3.2.1.min.js"></script>
    <script src="../js/im_index/commons.js"></script>
    <script src="../js/framework/bootstrap.min.js"></script>


    <script>
        checkRole(0)
        checkLogin()
        var aid = localStorage.getItem("aid");


        $(function () {

            // 个人信息初始化
            topinfo.nickname = localStorage.getItem("nickname");
            topinfo.avatarUrl = localStorage.getItem("avatarUrl");

        });


        // 头条个人栏
        var topinfo = new Vue({
            el: '#top',
            data: {
                nickname: "",
                avatarUrl: ""
            },
            methods: {

            },
        });

        var info = new Vue({
            el: '#service-list',
            data: {
                address: "",
                tip:""
            },
            methods: {
                upUserinfo: function () {
                    if (info.address == "") {
                        info.tip = "请输入完整!";
                        return;
                    }
                    var upUserinfo = "http://localhost:8080/user/upUserinfo?aid=" + aid + "&address=" +  info.address;
                    $.get(upUserinfo, function (result) {
                        info.tip = result.msg;
                    });

                }
            }
        });
    </script>

</body>

</html>